{% extends 'base/index.html' %}
{% block top_nav_article %} disabled border border-warning {% endblock %}
{% block section %}
<div class="container mt-1">
    <div class="row">
        <div class=" bg-light rounded">
            <a  onclick="replaceback('/articles/');" class="{{ 'disabled text-warning' if level == None else ''}} btn bg-white w-auto ">
                全部
            </a>
            {% for i in csfub %}
            <a onclick="replaceback('/articles/l={{ i.id }}&p={{ page }}');" class="{{ 'disabled text-warning' if level == i.id else ''}} btn bg-white w-auto ">
                {{ i.name }}
            </a>
            {% endfor %}
        </div>
        {% for i in cswzb %}
            {% if level == i.w or level == None %}
        <a href="/articles/{{ i.id }}" class="d-block link-secondary col-xs-12 col-md-6 mt-1">
            <div class="info px-3 py-3 border shadow-sm bg-body-tertiary bg-white" style="border-radius: 1rem;">
                <h5 class="card-title text-truncate">{{ i.name }}</h5>
                <div class="card-text text-truncate-3h" style="margin-top: 5px;margin-bottom: 5px;">{{ i.intor|safe }}</div>
                <span class="">
                    <i class="fa-solid fa-tag"></i>
                    {{ i.tag }}
                </span>
                <span class="">
                    <i class="fa-solid fa-eye"></i>
                    {{ i.c }}
                </span>
                <span class="">
                    <i class="fa-solid fa-thumbs-up"></i>
                    {{ i.p }}
                </span>
            </div>
        </a>
            {% endif %}
        {% endfor %}
    </div>
{% if cswzb|length > 10 %}
<div class="d-flex justify-content-center"><div class="" id="demo0"></div></div>
{% endif %}
<script>
layui.use(['laypage', 'layer'], function(){
  var laypage = layui.laypage
  ,layer = layui.layer;

  //总页数低于页码总数
     laypage.render({
    elem: 'demo0'
    ,count: {{ cswzb|length }} //数据总数
      ,jump: function(obj, first){
    //obj包含了当前分页的所有参数，比如：
    //首次不执行
    if(!first){
      window.location.href="/articles/l={{ level }}&p=" + obj.curr;
    }
  }
  });



});
</script>
</div>
{% endblock %}
